package kelisPkg.soundPackage
{
	import flash.utils.Dictionary;

	public class SoundManager
	{
		public function SoundManager()
		{
		}
		static private var _instance:SoundManager;
		static public function get instance():SoundManager{
			_instance=_instance||new SoundManager;
			return _instance;
		}
		
		
		
		private var _bgSoundDic:Dictionary=new Dictionary;
		private var _bgSound:SoundBase
		private var _bgSoundVol:int=100;
		
		private var _comSoundDic:Dictionary=new Dictionary;
		private var _comSound:SoundBase
		private var _comSoundVol:int=100;
		public function playBgSound(str:String):void{
			if(_bgSoundDic[str]){
				_bgSound=_bgSoundDic[str];
				_bgSound.play(SoundStatus.LOOP,SoundStatus.FADE_IN);
			}else{
				_bgSound=new SoundBase(str,SoundStatus.LOOP,SoundStatus.FADE_IN);
				_bgSoundDic[str]=_bgSound;
			}
			_bgSound.vol=_bgSoundVol;
			
		}
		public function replayBgSound():void{
			_bgSound.replay();
		}
		public function pauseBgSound():void{
			_bgSound.pause();
		}
		public function setBgSoundVol(value:int):void{
			_bgSound.vol=_bgSoundVol=value;
		}
		
		
		
		public function playComSound(str:String):void{
			if(_comSoundDic[str]){
				_comSound=_bgSoundDic[str];
				_comSound.play();
			}else{
				_comSound=new SoundBase(str);
				_comSoundDic[str]=_bgSound;
			}
			_comSound.vol=_comSoundVol;
			
		}
		public function replayComSound():void{
			_comSound.replay();
		}
		public function pauseComSound():void{
			_comSound.pause();
		}
		public function setComSoundVol(value:int):void{
			_comSound.vol=_comSoundVol=value;
		}
		
		
		public function setTotalVol(value:int):void{
			setBgSoundVol(value);
			setComSoundVol(value);
		}
									
	}
}